<!DOCTYPE html>
<html>
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type">
    <title>XHR2</title>
</head>
<body>
<div id="msg">loading...</div>
<script type="text/javascript">
    function logs() {
        var s = '';
        for (var i = 0,aLen = arguments.length; i < aLen; i++) {
            s += arguments[i] + ' ';
        }
        s = s.slice(0, -1);
        if (!window.console) alert(s);
        else
            console.log(s);

    }
    function setProgress(s) {
        document.getElementById("msg").innerHTML = s;
    }
    var xhr = new XMLHttpRequest();  
    xhr.open('get', 'a.php', true);

   xhr.onprogress=function(e){

   }

    xhr.onload = function(e) {
        setProgress("finished");
        setProgress(xhr.responseText)
    }

    xhr.onerror = function(e) {
        setProgress("error");
    }
    xhr.send();
     // console.dir(xhr);


</script>
</body>
</html>